function e(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}

function t(e, t, r) {
    var n = e.complete;
    return "function" == typeof n && (e.complete = function() {
        var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).data, t = void 0 === e ? {} : e;
        n(i.default.clearBOMAndParseJson(t));
    }), o({}, e, {
        header: (0, d.generateHeaderParams)(),
        success: function(e) {
            var n = e.data, a = e.statusCode;
            200 === a ? t(i.default.clearBOMAndParseJson(n)) : r({
                errMsg: a,
                data: n
            });
        },
        fail: r
    });
}

function r(e) {
    return new s.default(function(r, n) {
        wx.request(t(e, r, n));
    });
}

function n(e) {
    return new s.default(function(r, n) {
        wx.uploadFile(t(e, r, n));
    });
}

function a(e, t, n) {
    return r(o({}, n, {
        url: e,
        data: t,
        method: "GET"
    }));
}

function u(e, t, n) {
    return r(o({}, n, {
        url: e,
        data: t,
        method: "POST"
    }));
}

Object.defineProperty(exports, "__esModule", {
    value: !0
});

var o = Object.assign || function(e) {
    for (var t = 1; t < arguments.length; t++) {
        var r = arguments[t];
        for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
    }
    return e;
};

exports.request = r, exports.upload = n, exports.get = a, exports.post = u;

var s = e(require("./promise.js")), i = e(require("./util.js")), d = require("./api-signature");

exports.default = {
    request: r,
    upload: n,
    get: a,
    post: u
};